public static void main(String[] args)
The Java compiler would accept the line. But it looks sloppy to human eyes.
println()
Here is the example program again:
class Hello { public static void main ( String[] args ) { System.out.println("Hello World!"); } }
The main method of this program consists of a single statement:
System.out.println("Hello World!");
This statement writes the characters inside the quotation marks to the monitor of the computer system. (The quotation marks are not written.)
The part "Hello World!"
is called a string.
A string is a sequence of characters.
This program writes a string to the monitor and then stops.
(Review: ) Say that the file Hello.java
contains the example program.
The file is contained in the subdirectory C:\Temp
on the hard disk.
In order to run it, what two things must be done?